<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
            font-size: 16px;
        }
        li{
            display: inline-block;
        }
        .box {
            width: 100%;
        }
        ul {
            width: 100%;
        }
        ul li {
            width: 23.9%;
            height: 100px;
            margin: 0;
        }
        .pink {
            background: pink;
        }
        .red {
            background:red;
        }
    </style>
</head>
<body>
    <div class="box">
        <ul>
            <li class="pink">我的</li>
            <li class="pink">首页</li>
            <li class="pink">商城</li>
            <li class="pink">资讯</li>
        </ul>
    </div>
</body>
<script>
    var oli = document.getElementsByTagName('li')
    for (var i=0;i<oli.length;i++) {
        oli[i].onclick = function(){
        // 清除点击的元素的className            
        this.className = ''
        // 给点击的li 添加新的class
        this.className = 'red'

        }
    }
    // 删除数组中的name
var obj={
name:"李四",
age:"18",
type:"1"
}
console.log(obj)
delete obj.name
console.log(obj)
</script>
</html>